//@ts-ignore
import getApiData from '@/services/cpasRequest';

// 获取账套
export async function getAccountInfo(
  api: string,
  params: {
    dbname: string;
    startYear?: string;
    endYear?: string;
    typeCode?: string;
    mainType?: string;
    dates?: string[];
    dataFieldA?: string[];
    dataFieldB?: string[];
    dataId?: string;
  },
) {
  if (!params.dbname) return [];
  const res = await getApiData(api, params);
  if (res.ok) {
    return Promise.resolve({
      data: res.data,
      success: true,
    });
  }
  return Promise.resolve({
    data: [],
    success: false,
  });
}
